package com.muyu.danmo.service.impl;

import com.muyu.common.core.utils.DateUtils;
import com.muyu.danmo.domain.DanmoNewsPhone;
import com.muyu.danmo.mapper.DanmoNewsPhoneMapper;
import com.muyu.danmo.service.IDanmoNewsPhoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 新闻图片Service业务层处理
 *
 * @author yangle
 * @date 2024-09-19
 */
@Service
public class DanmoNewsPhoneServiceImpl implements IDanmoNewsPhoneService
{
    @Autowired
    private DanmoNewsPhoneMapper danmoNewsPhoneMapper;

    /**
     * 查询新闻图片
     *
     * @param newsPhoneId 新闻图片主键
     * @return 新闻图片
     */
    @Override
    public DanmoNewsPhone selectDanmoNewsPhoneByNewsPhoneId(Long newsPhoneId)
    {
        return danmoNewsPhoneMapper.selectDanmoNewsPhoneByNewsPhoneId(newsPhoneId);
    }

    /**
     * 查询新闻图片列表
     *
     * @param danmoNewsPhone 新闻图片
     * @return 新闻图片
     */
    @Override
    public List<DanmoNewsPhone> selectDanmoNewsPhoneList(DanmoNewsPhone danmoNewsPhone)
    {
        return danmoNewsPhoneMapper.selectDanmoNewsPhoneList(danmoNewsPhone);
    }

    /**
     * 新增新闻图片
     *
     * @param danmoNewsPhone 新闻图片
     * @return 结果
     */
    @Override
    public int insertDanmoNewsPhone(DanmoNewsPhone danmoNewsPhone)
    {
        danmoNewsPhone.setCreateTime(DateUtils.getNowDate());
        return danmoNewsPhoneMapper.insertDanmoNewsPhone(danmoNewsPhone);
    }

    /**
     * 修改新闻图片
     *
     * @param danmoNewsPhone 新闻图片
     * @return 结果
     */
    @Override
    public int updateDanmoNewsPhone(DanmoNewsPhone danmoNewsPhone)
    {
        danmoNewsPhone.setUpdateTime(DateUtils.getNowDate());
        return danmoNewsPhoneMapper.updateDanmoNewsPhone(danmoNewsPhone);
    }

    /**
     * 批量删除新闻图片
     *
     * @param newsPhoneIds 需要删除的新闻图片主键
     * @return 结果
     */
    @Override
    public int deleteDanmoNewsPhoneByNewsPhoneIds(Long[] newsPhoneIds)
    {
        return danmoNewsPhoneMapper.deleteDanmoNewsPhoneByNewsPhoneIds(newsPhoneIds);
    }

    /**
     * 删除新闻图片信息
     *
     * @param newsPhoneId 新闻图片主键
     * @return 结果
     */
    @Override
    public int deleteDanmoNewsPhoneByNewsPhoneId(Long newsPhoneId)
    {
        return danmoNewsPhoneMapper.deleteDanmoNewsPhoneByNewsPhoneId(newsPhoneId);
    }
}
